package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TSkillLevelInfoTemp;
import cn.com.headfree.mouldshow.dao.TSkillLevelInfoTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tSkillLevelInfoTempDao")
public class TSkillLevelInfoTempDaoImpl extends BaseDaoImpl<TSkillLevelInfoTemp> implements TSkillLevelInfoTempDao {


    @Override
    public void saveInfo(TSkillLevelInfoTemp tSkillLevelInfo) {
        String sql = "insert into t_skill_level_info_temp (id,erp_no,user_name,id_card_no,acqu_time,tech_type,qualifi_level,audit_org,org_level,cert_no,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,business_type_id,primitive_id,post_time) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},").append("#{user_name,jdbcType=VARCHAR},")
                .append("#{id_card_no,jdbcType=VARCHAR},").append("#{acqu_time,jdbcType=DATE},")
                .append("#{tech_type,jdbcType=VARCHAR},").append("#{qualifi_level,jdbcType=VARCHAR},")
                .append("#{audit_org,jdbcType=VARCHAR},").append("#{org_level,jdbcType=VARCHAR},")
                .append("#{cert_no,jdbcType=VARCHAR},").append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
                .append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
                .append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
                .append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
                .append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},")
                .append("#{orignal_id,jdbcType=VARCHAR},").append("#{business_type_id,jdbcType=VARCHAR},")
                .append("#{primitive_id,jdbcType=VARCHAR},").append("#{post_time,jdbcType=DATE})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tSkillLevelInfo.getId());
        params.put("erp_no", tSkillLevelInfo.getErpNo());
        params.put("user_name", tSkillLevelInfo.getUserName());
        params.put("id_card_no", tSkillLevelInfo.getIdCardNo());
        params.put("acqu_time", tSkillLevelInfo.getAcquTime());
        params.put("tech_type", tSkillLevelInfo.getTechType());
        params.put("qualifi_level", tSkillLevelInfo.getQualifiLevel());
        params.put("audit_org", tSkillLevelInfo.getAuditOrg());
        params.put("org_level", tSkillLevelInfo.getOrgLevel());
        params.put("cert_no", tSkillLevelInfo.getCertNo());
        params.put("org_id", tSkillLevelInfo.getOrgId());
        params.put("creater_id", tSkillLevelInfo.getCreaterId());
        params.put("creater_name", tSkillLevelInfo.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tSkillLevelInfo.getUpdaterId());
        params.put("updater_name", tSkillLevelInfo.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("is_valid", tSkillLevelInfo.getIsValid());
        params.put("audit_state", tSkillLevelInfo.getAuditState());
        params.put("orignal_id", tSkillLevelInfo.getOrignalId());
        params.put("business_type_id", tSkillLevelInfo.getBusinessTypeId());
        params.put("primitive_id", tSkillLevelInfo.getPrimitiveId());
        params.put("post_time", tSkillLevelInfo.getPostTime());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
